package xyz.hrz.ctl;

import com.jfinal.aop.Inject;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Record;
import xyz.hrz.service.mq.MQRedisPub;

import java.time.LocalDateTime;
import java.util.UUID;

/**
 * @author hrz
 * @description
 * @create: 2019-10-20
 */
public class MQCtl extends Controller {

    @Inject
    MQRedisPub redisPub;

    public void redis(){
        Record msg = new Record();
        msg.set("id", UUID.randomUUID());
        msg.set("time", LocalDateTime.now());
        System.out.println(redisPub.push(msg));
        renderJson("添加消息到redis... "+msg.toJson());
    }
}
